package com.feinno.urcs.group.entity;

import com.feinno.superpojo.SuperPojo;
import com.feinno.superpojo.annotation.Field;
import com.feinno.urcs.group.GroupConfiguration;
import com.feinno.urcs.nai.IMPU;

import javax.sip.address.SipURI;
import javax.sip.address.URI;

/**
 * GroupUri: sip:1252000-conferenceUri@feinno.com;
 * Created by honghao on 5/4/15.
 */
public class GroupIndex extends SuperPojo {
    @Field(id = 1)
    private int groupId;
    @Field(id = 2)
    private int logicalPool;

    public String getConferenceUri() {
        return toConferenceUri(this.groupId);
    }

    public static String toConferenceUri(int groupId) {
        StringBuilder sb = new StringBuilder();
        sb.append("sip:");
        sb.append(GroupConfiguration.INSTANCE.getGroupPrefix());
        sb.append(groupId);
        sb.append("@");
        sb.append(GroupConfiguration.INSTANCE.getGroupDomain());
        return sb.toString();
    }

    public GroupIndex() {

    }

    public GroupIndex(int groupId, int logicalPool) {
        this.groupId = groupId;
        this.logicalPool = logicalPool;
    }

    @Override
    public String toString() {
        return getConferenceUri();
    }

    public int getLogicalPool() {
        return logicalPool;
    }

    public void setLogicalPool(int logicalPool) {
        this.logicalPool = logicalPool;
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
}